package com.guigu.zj.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.mapper.MakeMapper;
import com.guigu.pojo.Make;
import com.guigu.zj.pojo.PageVo;
import com.guigu.zj.service.MakeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
@Service
public class MakeServiceImpl implements MakeService {
    @Autowired
    MakeMapper makeMapper;
    public PageVo<Make> queryAll(PageVo<Make> pageVo) {
        PageHelper.startPage(pageVo.getPage(),pageVo.getNum());
        List<Make> makes = makeMapper.queryAll(pageVo);
        PageInfo pageInfo = new PageInfo(makes);
        long total = pageInfo.getTotal();
        PageVo<Make> vo = new PageVo<Make>();
        vo.setRows(makes);
        vo.setTotal(total);
        return vo;
    }
}
